<?php
/**
 * Created by PhpStorm.
 * User: 魏爷
 * Date: 2016/5/28
 * Time: 17:58
 */

namespace Home\Model;

class ContentModel extends BaseModel
{
    // 数据表名（不包含表前缀）
    protected $tableName        =   'content';

    /***
     * 安全问题清空
     * @param Integer $u_id 用户ID
     * @return boolean
    ***/
    public function delectContent($u_id)
    {
        $res=$this->where("u_id=$u_id")->delete();
        if ($res==false) {
            return false;
        } else {
            return true;
        }
    }
    /**
     * 安全问题添加
     * @param Integer $u_id 用户ID
     * @param Integer $topic_id 题目ID
     * @param String $content_name 答案
     * @return boolean
     **/
    public function safetyAdd($u_id, $topic_id, $content_name)
    {
        $data['topic_id']=$topic_id;
        $data['content_name']=$content_name;
        $data['u_id']=$u_id;
        $res=$this->add($data);
        if ($res>0) {
            return true;
        } else {
            return false;
        }
    }
}
